/**
 * Copyright 2015-2016 The OpenZipkin Authors
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
package com.garen.core;


import lombok.Data;

import java.io.ObjectStreamException;
import java.io.Serializable;
import java.io.StreamCorruptedException;
import java.util.*;


/**
 * A trace is a series of spans (often RPC calls) which form a latency tree.
 * <p>
 * <p>Spans are usually created by instrumentation in RPC clients or servers, but can also
 * represent in-process activity. Annotations in spans are similar to log statements, and are
 * sometimes created directly by application developers to indicate events of interest, such as a
 * cache miss.
 * <p>
 * <p>The root span is where {@link #parentId} is null; it usually has the longest {@link #duration} in the
 * trace.
 * <p>
 * <p>Span identifiers are packed into longs, but should be treated opaquely. String encoding is
 * fixed-width lower-hex, to avoid signed interpretation.
 */
@Data
public final class Span implements Comparable<Span>, Serializable {
    private static final long serialVersionUID = 0L;
    public String traceId;//traceid
    public String name;//名称
    public String id;//数据id
    public String parentId;
    public Long timestamp;
    public Long duration;
    public List<SpanTags> spanTagses;
    public Endpoint endpoint;//数据的主机信息
    private int type;

    /**
     * 数据类型
     */
    public interface SpanType {
        int HTTP = 1;
        int DATABASE = 2;
        int METHOD = 3;
    }

    @Override
    public int compareTo(Span o) {
        return 0;
    }
}
